package com.ssn.strategy.book;

public class Client {
    public static void main(String[] args) {
        StrategyFactory computerStrategyFactory = ComputerStrategyFactory.getInstance();
        StrategyFactory  languageStrategyFactory= LanguageStrategyFactory.getInstance();
        StrategyFactory novelStrategyFactory = NovelStrategyFactory.getInstance();

        Book book = new Book(7,30);
        System.out.println("7本书  每本假设都30");
        book.setStrategy(computerStrategyFactory.createStrategy());
        double finalPay = book.finalPay();
        System.out.println("计算机类打折：210 * 0.9 " + finalPay);

        book.setStrategy(languageStrategyFactory.createStrategy());
        finalPay = book.finalPay();
        System.out.println("语言类数计打折 ：每本2元折扣 " + finalPay);

        book.setStrategy(novelStrategyFactory.createStrategy());
        finalPay = book.finalPay();
        System.out.println("小说打折： 100元有15折扣" + finalPay);
    }
}
